package br.edu.universo.si.projeto2.infojob.client.apresentacao;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowResizeListener;
import com.google.gwt.user.client.ui.DecoratedStackPanel;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.StackPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class AMenuProfissional extends DockPanel implements WindowResizeListener
{
	private Hyperlink alteraContaLink;
	private Hyperlink alterarSenhaLink;
	private Hyperlink encerraContaLink;
	private Hyperlink logoffLink;
	private Hyperlink buscarVagasLink;
	private Hyperlink caixaEntradaMensagensLink;
	private Hyperlink mensagensEnviadasLink;
	private Hyperlink realizaDenunciaLink;	
	private Hyperlink curriculoLink;
	private Hyperlink relatorio;
	
	
	
	public AMenuProfissional()
	{
		this.add(criarMenuProfissional(), DockPanel.CENTER);
		Window.addWindowResizeListener(this);
		DeferredCommand.addCommand(new Command(){
			public void execute() {
				onWindowResized(Window.getClientWidth(), Window.getClientHeight());
			}
		});
		onWindowResized(Window.getClientWidth(), Window.getClientHeight());		
	}
	
	private StackPanel criarMenuProfissional()
	{
		DecoratedStackPanel stackPanel = new DecoratedStackPanel();
		stackPanel.setWidth("250px");
		stackPanel.setHeight("100%");
		
		VerticalPanel contaPanel = new VerticalPanel();
		VerticalPanel curriculoPanel = new VerticalPanel();
		VerticalPanel vagasPanel = new VerticalPanel();
		VerticalPanel mensagensPanel = new VerticalPanel();
		
		contaPanel.setSpacing(5);
		curriculoPanel.setSpacing(5);
		vagasPanel.setSpacing(5);
		mensagensPanel.setSpacing(5);
		
		alteraContaLink = new Hyperlink("Alterar Conta", null);
		alterarSenhaLink = new Hyperlink("Alterar Senha", null);
		encerraContaLink = new Hyperlink("Encerrar Conta", null);

		logoffLink = new Hyperlink("Logoff", null);
		curriculoLink = new Hyperlink("Lista Curriculos", null);
		buscarVagasLink = new Hyperlink("Buscar Vagas", null);
		caixaEntradaMensagensLink = new Hyperlink("Caixa de Entrada", null);
		mensagensEnviadasLink = new Hyperlink("Mensagens Enviadas", null);
		realizaDenunciaLink = new Hyperlink("Realizar Denúncia", null);
		relatorio = new Hyperlink("Relatorio Curriculo", null);
		
		
		contaPanel.add(alteraContaLink);
		contaPanel.add(alterarSenhaLink);
		contaPanel.add(encerraContaLink);
		contaPanel.add(logoffLink);
		
		curriculoPanel.add(curriculoLink);
		curriculoPanel.add(relatorio);
		
		
		vagasPanel.add(buscarVagasLink);
		
		mensagensPanel.add(caixaEntradaMensagensLink);
		mensagensPanel.add(mensagensEnviadasLink);
		mensagensPanel.add(realizaDenunciaLink);
		
		stackPanel.add(contaPanel, "Conta");
		stackPanel.add(curriculoPanel, "Currículo");
		stackPanel.add(vagasPanel, "Vagas");
		stackPanel.add(mensagensPanel, "Mensagens");
		
		return stackPanel;
	}

	public Hyperlink getAlteraContaLink() {
		return alteraContaLink;
	}

	public void setAlteraContaLink(Hyperlink alteraContaLink) {
		this.alteraContaLink = alteraContaLink;
	}

	public Hyperlink getAlterarSenhaLink() {
		return alterarSenhaLink;
	}

	public void setAlterarSenhaLink(Hyperlink alterarSenhaLink) {
		this.alterarSenhaLink = alterarSenhaLink;
	}

	public Hyperlink getEncerraContaLink() {
		return encerraContaLink;
	}

	public void setEncerraContaLink(Hyperlink encerraContaLink) {
		this.encerraContaLink = encerraContaLink;
	}

	public Hyperlink getLogoffLink() {
		return logoffLink;
	}

	public void setLogoffLink(Hyperlink logoffLink) {
		this.logoffLink = logoffLink;
	}

	public Hyperlink getBuscarVagasLink() {
		return buscarVagasLink;
	}

	public void setBuscarVagasLink(Hyperlink buscarVagasLink) {
		this.buscarVagasLink = buscarVagasLink;
	}

	public Hyperlink getCaixaEntradaMensagensLink() {
		return caixaEntradaMensagensLink;
	}

	public void setCaixaEntradaMensagensLink(Hyperlink caixaEntradaMensagensLink) {
		this.caixaEntradaMensagensLink = caixaEntradaMensagensLink;
	}

	public Hyperlink getMensagensEnviadasLink() {
		return mensagensEnviadasLink;
	}

	public void setMensagensEnviadasLink(Hyperlink mensagensEnviadasLink) {
		this.mensagensEnviadasLink = mensagensEnviadasLink;
	}

	public Hyperlink getRealizaDenunciaLink() {
		return realizaDenunciaLink;
	}

	public void setRealizaDenunciaLink(Hyperlink realizaDenunciaLink) {
		this.realizaDenunciaLink = realizaDenunciaLink;
	}
	
	public void setCurriculoLink(Hyperlink curriculoLink) {
		this.curriculoLink = curriculoLink;
	}

	public Hyperlink getCurriculoLink() {
		return curriculoLink;
	}

	public Hyperlink getRelatorio() {
		return relatorio;
	}

	public void setRelatorio(Hyperlink relatorio) {
		this.relatorio = relatorio;
	}

	public void onWindowResized(int width, int height) {
		int largura = width - this.getAbsoluteLeft() - 9;
		if((largura < 250) ||( largura > 250)){
			largura = 250;
		}
		int altura = height - this.getAbsoluteTop() - 9;
		if(altura < 1){
			altura = 1;
		}
		
		this.setPixelSize(largura, altura);
	}


}